![]() |
GemaCoreLib
The GeMA Core library
|
Base interface class for NumSolver type plugins. More...
#include <gmNumSolver.h>


Public Member Functions | |
| GmNumSolver (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger) | |
| Constructor. | |
| virtual | ~GmNumSolver () |
| Virtual destructor. | |
| virtual const char * | pluginCategory () const |
| Returns the plugin category. | |
| virtual GmSolverMatrix * | newMatrix (int nlin, int ncol, const GmSolverMatrix *sharedLayout, int numThreads=-1) const =0 |
| Creates and returns a new matrix with size nlin x ncol, of the appropriate type for use in a later call to solve(). Returns NULL if the matrix could not be allocated. | |
| virtual bool | setSolverTolerance (double tol)=0 |
| Updates the desired tolerance before a call to solve(). Returns false if not supported by the solver. | |
| bool | solve (GmSolverMatrix *A, const GmVector &b, GmVector &x, bool xIsGuess=false) const |
| Solves the linear system Ax = b, filling the vector x with the calculated result. | |
| virtual void | printParameters (const GmLogCategory &logger) |
| Asks the numeric solver to print all of its parameters using the provided logger. | |
| virtual QString | quickDescription () const =0 |
| Returns a quick description of the linear solver to be used on the FEM report. | |
| virtual int | trackItemId () const |
| If the solver creates a ProgressStatsItem to track execution time, returns the item id. Returns -1 if no tracking is done. | |
Public Member Functions inherited from GmPluginObject | |
| GmPluginObject (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger) | |
| Constructor. | |
| virtual | ~GmPluginObject () |
| Destructor. | |
| QString | id () const |
| Returns the object id. | |
| QString | description () const |
| Returns the object description. | |
| QString | pluginTypeName () const |
| Returns the hierarchical type name for the plugin object type. See also pluginName() and pluginType(). | |
| virtual const char * | pluginName () const =0 |
| Returns a string identifying the plugin which implements this object. Should return the SAME string as the one read from the plugin information file in the pluginName field. | |
| virtual const char * | pluginType () const =0 |
| Returns the string identifying the plugin object type. Should return the SAME string as the one read from the plugin information file in the objectTypes table. | |
| virtual bool | loadPrivateData (LuaTable &table)=0 |
| Function called by the model loader to give the object acess to it's private parameters. Should return false only if the received parameter set makes the use of this object impossible. | |
Protected Member Functions | |
| virtual bool | solveImpl (GmSolverMatrix *A, const GmVector &b, GmVector &x, bool xIsGuess) const =0 |
| Actual implementation of the solve function. Should be implemented by derived classes. | |
Protected Member Functions inherited from GmPluginObject | |
| virtual const GmLogCategory & | logger () const |
| Returns the internal logger used by the plugin to emmit messages. | |
| GmSimulationData * | simulationData () const |
| Returns a reference to the simulation data object keeping global simulation information. | |
Private Member Functions | |
| bool | checkNanInf (const GmSolverMatrix *A, const GmVector &b) const |
| If _checkNanInf is true and A or b have nan or inf values, logs an error message and returns false. Returns true otherwise. | |
Private Attributes | |
| bool | _checkNanInf |
| Should we check for NaN or Inf values in the vectors before solving the system? | |
Friends | |
| class | GmNumSolverPrinter |
Base interface class for NumSolver type plugins.
| GmNumSolver::GmNumSolver | ( | GmSimulationData * | simulation, |
| QString | id, | ||
| QString | description, | ||
| const GmLogCategory & | logger ) |
Constructor.
| simulation | Reference to the simulation object. |
| id | NumSolver id. |
| description | NumSolver description. |
| logger | Plugin logger object used to emit messages |
|
pure virtual |
Creates and returns a new matrix with size nlin x ncol, of the appropriate type for use in a later call to solve(). Returns NULL if the matrix could not be allocated.
If given, the sharedLayout matrix should provide another matrix, with the SAME concrete object type as this one, that will share its sparse layout (position of non-zero elements) with this matrix. The number of threads parameter can be used by the sparse matrix building routines to limit the number of threads used. The default equals to the maximum number of threads as seen by the thread manager.
|
inlinevirtual |
Returns the plugin category.
Implements GmPluginObject.
|
virtual |
Asks the numeric solver to print all of its parameters using the provided logger.
The default implementation logs the data, as seen through the access interface;
Implements GmPluginObject.
|
inline |
Solves the linear system Ax = b, filling the vector x with the calculated result.
The xIsGuess parameter should be passed as true if the current contents of x should be used as an initial guess to solve the linear system, false otherwise. Passing false is always safe but can be slower if x is already close to the result.
If A is a matrix with size equal to M x N, x should have size N and b should have size M. Returns false if a solution could not be found.
IMPORTANT: For most solvers, A MUST be a matrix created with a call to the solver newMatrix() routine.
IPORTANT2: Most solvers only accept square matrices. The std Armadillo based solver accepts non square matrices only if full matrices are used. Sparse matrices must be square.
IMPORTANT3: If the simulation was configured with the checkNaNInf option set to true, this call will check both A and b for nan and inf values. If found, it will return false without ever trying to solve the system.